
/**
* 左边菜单
*/ 
<template>
  <el-menu default-active="2"  :collapse="!collapsed" :collapse-transition="false" router :default-active="$route.path"
    unique-opened class="el-menu-vertical-demo" background-color="#334157" text-color="#fff"
    active-text-color="#ffd04b">

    <div class="logobox">
      <img class="logoimg" src="../assets/img/logo.png" alt="">
    </div>

    <el-submenu v-for="menu in allmenu" :key="menu.id" :index="menu.menuName">
      <template slot="title">
        <svg-icon :icon-class="menu.icon"/>
        <span class="titleclass">{{menu.menuName}}</span>
      </template>
      <el-menu-item-group>
        <el-menu-item v-for="chmenu in menu.children"  :index="chmenu.path" :key="chmenu.id">
          <svg-icon :icon-class="chmenu.icon"/>
          <span class="titleclass">{{chmenu.menuName}}</span>
        </el-menu-item>
      </el-menu-item-group>
    </el-submenu>
  </el-menu>
</template>


<script>
import { mapGetters } from 'vuex'
import { listMenu } from "@/api/system/menu";
export default {
  name: 'LeftNav',
  data() {
    return {
      // collapsed: false,
      allmenu: []
    }
  },
  computed: {
    ...mapGetters({
      collapsed: 'collapsed',
    }),
  },
  created() {
    this.handleMenu();
  },
  methods: {
    handleMenu() {
      listMenu({visible:0}).then((response) => {
      this.allmenu = this.handleTree(response.data,'menuId');
      })
    },
  }
}
</script>

<style>
.el-aside {
  background: #334157;
  transition: width 0.25s;
  -webkit-transition: width 0.25s;
  -moz-transition: width 0.25s;
  -webkit-transition: width 0.25s;
  -o-transition: width 0.25s;
  overflow: hidden;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 210px;
  min-height: 400px;
}

.el-menu-vertical-demo:not(.el-menu--collapse) {
  border: none;
  text-align: left;
}

.el-menu-item-group__title {
  padding: 0px;
}

.el-menu-bg {
  background-color: #1f2d3d !important;
}

.el-menu {
  border: none;
}

.logobox {
  height: 40px;
  line-height: 40px;
  color: #9d9d9d;
  font-size: 20px;
  text-align: center;
  padding: 20px 0px;
}

.logoimg {
  height: 40px;
}

.titleclass{
  margin-left: 15px;
}
</style>